package com.bjpowernode.spring6.test;

import com.bjpowernode.spring6.staticproxy.service.impl.UserServiceStaImpl;
import com.bjpowernode.spring6.staticproxy.service.impl.UserServiceStaImplProxy;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class StaticProxy {
    @Test
    public void testStaticProxy(){
        ApplicationContext applicationContext =
                new ClassPathXmlApplicationContext("spring.xml");
        UserServiceStaImpl userServiceSta =
                applicationContext.getBean("userServiceSta", UserServiceStaImpl.class);
        UserServiceStaImplProxy userServiceStaImplProxy =
                applicationContext.getBean
                        ("userServiceStaImplProxy", UserServiceStaImplProxy.class);
        userServiceStaImplProxy.save(5);
    }
}
